//
//  UserDefaultViewController.m
//  GCD
//
//  Created by fangyuan ding on 2020/8/12.
//  Copyright © 2020 fangyuan ding. All rights reserved.
//

#import "UserDefaultViewController.h"

@interface UserDefaultViewController ()

@end

@implementation UserDefaultViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //写入到磁盘中
    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    [userDefault setObject:@"北京" forKey:@"city"];
    [userDefault synchronize];
    
    //读取
    NSUserDefaults *getUserDefault = [NSUserDefaults standardUserDefaults];
    NSString *content = [getUserDefault objectForKey:@"city"];
    NSLog(@"%@",content);
   
}



@end
